<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<base href="<%=basePath%>">
<html>
<head>

    <title>库房分配</title>
    <style type="text/css">
        td {
            font-size: 14px;
            text-align: center;
        }

        input {
            text-align: center;
        }

        table {
            text-align: center;
        }

        #sousuo1 {
            background-image: img / search-icon . png;
            position: relative;
            top: -18px;
            left: -15px
        }

        #xinxi {
            display: none;
            background-color: powderblue;
            position: absolute;
            left: 700PX;
            top: 180px;
        }

    </style>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
    <link type="text/css" rel="stylesheet" href="css/index.css"/>
    <script src="js/jquery.min.js"></script>
    <!-- 动态菜单JS -->
    <script type="text/javascript" src="js/menu.js"></script>
</head>

<body>

<div class="container">
    <div class="cont-top">
        <div class="companyname">ERP管理系统</div>
        <div class="cont-top-middle">
            <ul>
                <li><h1 STYLE="font-size: 45px;margin-left: 430px; margin-top: 10px">第&nbsp;五&nbsp;人&nbsp;民&nbsp;医&nbsp;院</h1>
                </li>

            </ul>
        </div>
        <div class="cont-top-rg">
            <ul class="advanced-menu">
                <li>
                    <div class="top-search">
                        <div class="t-s-l">
                            <span class="left-line"></span> <input type="text" value="搜库存"
                                                                   class="search-type" disabled> <span
                                class="triangle-bottom"></span>
                        </div>
                        <div class="t-s-l">


                            <form action="BuyServlet?act=sousuo" method="post">
                                <input type="text" placeholder="请输入商品编码或名称" name="sou"
                                       class="search-dt"> <span class="right-line"></span>
                                <span class="right-line"> <input
                                        type="submit" value="搜索" id="sousuo1"/></span>
                            </form>


                        </div>
                    </div>
                </li>
                <li class="default" style="position: relative;"><span
                        class="user"><img src="img/user.png"></span> <a
                        class="special" onclick="denglu()">${user.userName} <i><img
                        src="img/xl.png"></i></a>
                    <div class="drop-down-wrap"
                         style="width: 180px; left: 15px; display: none;">
                        <div class="drop-down">
                            <span class="triangle-border"></span> <span class="triangle-bg"></span>
                            <ul class="del-ul">
                                <li><a href="#" class="hot">首耀照明</a></li>
                                <li><a href="#">小丫头</a></li>
                                <li><a href="#">操作日志</a></li>
                            </ul>
                        </div>
                    </div>
                </li>
            </ul>
            <ul class="advanced-menu">
                <li id="p" style="display: none;"></li>
                <li><a href="#"><img src="img/top-icon2.png"></a></li>
                <li><a href="#"><img src="img/top-icon3.png"></a></li>
                <li><a href="#"><img src="img/top-icon4.png"></a></li>
                <li><a href="#"><img src="img/top-icon5.png"></a></li>
            </ul>
        </div>
    </div>
    <div class="left-menu" style="height:949px;">
        <div class="menu-list">
            <ul>
                <%--                menuNameOne menuPathList--%>
                <c:forEach var="menuNameOne" items="${menuNameOne}">
                    <li class="menu-list-01">

                        <p class="fumenu">${menuNameOne.menuNameOne}</p>
                        <img class="xiala" src="img/xiala.png"/>

                        <div class="list-p">
                            <c:forEach var="menuPathList" items="${menuPathList}">
                                <c:if test="${menuNameOne.menuNameOne==menuPathList.menuNameOne}">

                                    <a href="${menuPathList.menu.menuPath}" id="href">
                                        <p class="zcd" id="zcd5">${menuPathList.menu.menuNametwo}</p>
                                    </a>
                                </c:if>
                            </c:forEach>
                        </div>
                    </li>
                </c:forEach>
            </ul>


        </div>
    </div>

    <div class="right-menu">
        <div class="main-hd">
            <div class="page-teb">
                <div class="l-tab-links">
                    <ul style="left: 0;">
                        <li class="l-select"><a href="index.jsp"
                                                style="padding: 0px 25px;">首页</a></li>
                        <li class="l-select"><a href="#">库房分配</a> <span
                                class="close"></span></li>
                    </ul>
                </div>

                <div class="l-tab-content" style="background: #fff;">
                    <div class="tab-content-item">
                        <div class="home">
                            <!--库房分配   开始-->
                            <div class="kufang-box" style="height: 120px;margin-top: -10px;">
                                <div class="kufang" style="height: 80px;margin-left: -150px;margin-top: 5px">

                                    <div>
                                        <div class="kf-fl">
                                            <ul>
                                                <li STYLE="font-size: 15px;margin-left: 530px;margin-top: -12px; ">
                                                    日期:<SPAN></SPAN></li>

                                            </ul>

                                        </div>
                                        <div class="kf-fl">
                                            <ul>
                                                <li STYLE="font-size: 15px;margin-left: 530px;margin-top: -12px; ">
                                                    <SPAN></SPAN></li>

                                            </ul>

                                        </div>
                                    </div>
                                </div>

                                <div class="kf-tab"
                                     style="margin-left: 300px;width: 1000px;margin-top: -50px;height: 1000PX">


                                    <div class="kfbody" tabindex="0" STYLE="height: 1000PX">
                                        <table border="0" cellpadding="0" cellspacing="1"
                                               class="fkbody-rows" style="width: 100%;">
                                            <tbody>


                                            <td class="caption cao-l">

                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;" id="anhao"
                                                     name=${anhao}>序号
                                                </div>
                                            </td>


                                            <td class="caption cao-l">

                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">流水号
                                                </div>
                                            </td>
                                            <td class="caption cao-l">
                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">姓名
                                                </div>
                                            </td>

                                            <td class="caption cao-l">
                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">性别
                                                </div>
                                            </td>
                                            <td class="caption cao-l">
                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">科室
                                                </div>
                                            </td>
                                            <td class="caption cao-l">
                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">查看
                                                </div>
                                            </td>

                                            </tr>
                                            </tbody>

                                            <tbody>
                                            <c:set var="a" value="1"></c:set>
                                            <c:forEach var="summary" items="${summaryList}">
                                                <c:if test="${number!=summary.listingSerialNumber}">

                                                    <tr class="fkbody-s" _rowindex="0">
                                                        <td class="caption-kf" style="overflow: hidden;"
                                                            align="center">
                                                            <div class="caotion-kf-txt1">${a}</div>
                                                        </td>
                                                        <td class="bodyrow-list" _columnindex="0">
                                                            <div class="bodytxt"
                                                                 style="overflow: hidden; text-align: center;">
                                                                <input type="text" id=zichan${a}
                                                                       value="${summary.listingSerialNumber}"
                                                                       STYLE="background: #f6fcff;width: 100%"/>
                                                            </div>
                                                        </td>

                                                        <td class="bodyrow-list" _columnindex="1">
                                                            <div class="bodytxt" id="ming${a}"
                                                                 style="overflow: hidden; text-align: center;">${summary.sheetName}</div>
                                                        </td>

                                                        <td class="bodyrow-list" _columnindex="2">
                                                            <div class="bodytxt"
                                                                 style="overflow: hidden; text-align: center;">${summary.sheetSex}</div>
                                                        </td>

                                                        <td class="bodyrow-list" _columnindex="2">
                                                            <div class="bodytxt"
                                                                 style="overflow: hidden; text-align: center;">${summary.sheetDepartment}</div>
                                                        </td>

                                                        <td class="bodyrow-list" _columnindex="4">
                                                            <div class="bodytxt"
                                                                 style="overflow: hidden; text-align: center;">
                                                                <button
                                                                        onclick="contente(this.value)"
                                                                        VALUE="${summary.listingSerialNumber}">查看
                                                                </button>
                                                            </div>
                                                        </td>

                                                    </tr>


                                                </c:if>
                                                <c:set var="a" value="${a+1}"></c:set>
                                                <c:set var="number" value="${summary.listingSerialNumber}"></c:set>
                                            </c:forEach>
                                            </tbody>

                                        </table>


                                    </div>


                                    <div class="lu">
                                        共<i>${a-1}</i>条记录
                                    </div>

                                </div>
                                <div class="tab-btn">
                                    <div class="bt-f">
                                        <ul>
                                            <li><a href="BuyServlet?act=daochu" class="special">
                                                <button
                                                        class="button-li">选择导出
                                                </button>
                                            </a></li>
                                            <li>
                                                <button class="button-li">明细账本</button>
                                            </li>
                                            <li>
                                                <button class="button-li">价格方式</button>
                                            </li>
                                        </ul>
                                    </div>
                                    <div class="bt-rg">
                                        <ul>
                                            <li><a href="">
                                                <button>打印</button>
                                            </a></li>
                                            <li>
                                                <button>退出</button>
                                            </li>
                                        </ul>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>


    <table border="" cellspacing="" id="none1" cellpadding="" style="display: none;">
        <tbody id="fir">
        <tr class="fir">

            <td class="caption cao-l">

                <div class="caotion-kf-txt" style="overflow: hidden; background-color: #f7e1b5; text-align: center;"
                     id="anhao" name=${anhao}>
                </div>
            </td>


            <td class="caption cao-l">

                <div class="caotion-kf-txt" style="overflow: hidden; background-color: #f7e1b5;  text-align: center;">
                    一维码
                </div>
            </td>
            <td class="caption cao-l">
                <div class="caotion-kf-txt" style="overflow: hidden; background-color: #f7e1b5;  text-align: center;">姓名
                </div>
            </td>

            <td class="caption cao-l">
                <div class="caotion-kf-txt" style="overflow: hidden; background-color: #f7e1b5;  text-align: center;">
                    接受情况
                </div>
            </td>
            <td class="caption cao-l">
                <div class="caotion-kf-txt" style="overflow: hidden;  background-color: #f7e1b5; text-align: center;">
                    检查项目
                </div>
            </td>


        </tr>
        </tbody>


        <tbody id="sec">


        <tr _rowindex="0" class="sec">
            <td class="caption-kf" style="overflow: hidden;" align="center">
                <div class="caotion-kf-txt1"></div>
            </td>
            <td class="bodyrow-list" _columnindex="0">
                <div class="bodytxt" style="overflow: hidden; background-color: #f7e1b5;  text-align: center;">
                    sheetDimensioncode
                </div>
            </td>

            <td class="bodyrow-list" _columnindex="1">
                <div class="bodytxt" id="ming${a}"
                     style="overflow: hidden;  background-color: #f7e1b5; text-align: center;">sheetName
                </div>
            </td>

            <td class="bodyrow-list" _columnindex="2">
                <div class="bodytxt" style="overflow: hidden; background-color: #f7e1b5;  text-align: center;">
                    sheetReceive
                </div>
            </td>

            <td class="bodyrow-list" _columnindex="2">
                <div class="bodytxt" style="overflow: hidden;  background-color: #f7e1b5; text-align: center;">
                    sheetProject
                </div>
            </td>

            <td class="bodyrow-list" _columnindex="4">
                <div class="bodytxt" style="overflow: hidden; text-align: center;">
                    <button onclick="kan(this.value)" VALUE="chakan">详情
                    </button>
                </div>
            </td>

        </tr>


        </tbody>
    </table>


</body>
<script src="js\jquery.min.js"></script>
<script>

    function contente(val) {


        $(".sec1").each(function () {

            $(this).remove();

        })

        $(".fir1").each(function () {

            $(this).remove();

        })

        if ($(".fir").length == 1 && $(".sec").length == 1) {

            $.ajax({
                type: "post",
                url: "sheet/contente",
                dataType: "json",
                data: {"val": val},
                success: (function (data) {


                    for (i = 0; i < data.length; i++) {

                        var whole = JSON.parse(JSON.stringify(data[i]))
                        var number = whole.sheetId;
                        var sheetDimensioncode = whole.sheetDimensioncode;
                        var sheetName = whole.sheetName;
                        var sheetReceive = whole.sheetReceive
                        ;
                        var sheetProject = whole.sheetProject;

                        $("button").each(function () {
                            if ($(this).val() == val) {

                                var c = $("#sec").html()
                                var a = $("#fir").html()
                                if ($(".fir1").length > 0) {

                                    $("div").each(function () {
                                        if ($(this).html().trim() == sheetDimensioncode) {
                                            $(this).parent().parent().after(c)
                                        }
                                    })
                                } else {
                                    $(this).parent().parent().parent().after(a + c)
                                }


                                $("button").each(function () {
                                    if ($(this).val() == "chakan") {

                                        $(this).val(number+"&Dimensioncode="+sheetDimensioncode)

                                    }

                                })
                                $("div").each(function () {

                                    if ($(this).text().trim() == "sheetDimensioncode") {

                                        $(this).text(sheetDimensioncode)

                                    } else if ($(this).text().trim() == "sheetName") {
                                        $(this).text(sheetName)

                                    } else if ($(this).text().trim() == "sheetReceive") {
                                        $(this).text(sheetReceive)

                                    } else if ($(this).text().trim() == "sheetProject") {
                                        $(this).text(sheetProject)

                                    }

                                })


                            }
                        })


                        $(".sec").each(function () {

                            $(this).attr("class", "sec1");

                        })

                        $(".fir").each(function () {

                            $(this).attr("class", "fir1");

                        })

                        $("#none1").children().eq(1).children().children().eq(1).children().html("sheetDimensioncode")
                        $("#none1").children().eq(1).children().children().eq(2).children().html("sheetName")
                        $("#none1").children().eq(1).children().children().eq(3).children().html("sheetReceive")
                        $("#none1").children().eq(1).children().children().eq(4).children().html("sheetProject")
                        $("#none1").children().eq(1).children().children().eq(5).children().children().val("chakan")
                        $("#none1").children().eq(0).children().attr("class", "fir")
                        $("#none1").children().eq(1).children().attr("class", "sec")


                    }
                })

            })


        }
    }

    function kan(val) {
        window.location.href = "sheet/details?num=" + val

    }


    <c:if test="${cheng=='成功'}">
    alert("提交成功")
    <% session.removeAttribute("cheng");%>
    </c:if>
</script>

</html>
